package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConParkMemorabiliaFeedback;
import com.htgd.gardenexpo.dao.GeConParkMemorabiliaFeedbackDao;
import com.htgd.gardenexpo.service.GeConParkMemorabiliaFeedbackService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConParkMemorabiliaFeedback)表服务实现类
 *
 * @author makejava
 * @since 2021-06-10 11:07:50
 */
@Service("geConParkMemorabiliaFeedbackService")
public class GeConParkMemorabiliaFeedbackServiceImpl implements GeConParkMemorabiliaFeedbackService {
    @Resource
    private GeConParkMemorabiliaFeedbackDao geConParkMemorabiliaFeedbackDao;

    /**
     * 通过ID查询单条数据
     *
     * @param 主键
     * @return 实例对象
     */
    @Override
    public GeConParkMemorabiliaFeedback queryById() {
        return this.geConParkMemorabiliaFeedbackDao.queryById();
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConParkMemorabiliaFeedback> queryAllByLimit(int offset, int limit) {
        return this.geConParkMemorabiliaFeedbackDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeConParkMemorabiliaFeedback> getinfoByMemorabiliaId(int id) {
        return this.geConParkMemorabiliaFeedbackDao.getinfoByMemorabiliaId(id);
    }

    /**
     * 新增数据
     *
     * @param geConParkMemorabiliaFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConParkMemorabiliaFeedback insert(GeConParkMemorabiliaFeedback geConParkMemorabiliaFeedback) {
        this.geConParkMemorabiliaFeedbackDao.insert(geConParkMemorabiliaFeedback);
        return geConParkMemorabiliaFeedback;
    }

    /**
     * 修改数据
     *
     * @param geConParkMemorabiliaFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConParkMemorabiliaFeedback update(GeConParkMemorabiliaFeedback geConParkMemorabiliaFeedback) {
        this.geConParkMemorabiliaFeedbackDao.update(geConParkMemorabiliaFeedback);
        return this.queryById();
    }

    /**
     * 通过主键删除数据
     *
     * @param 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById() {
        return this.geConParkMemorabiliaFeedbackDao.deleteById() > 0;
    }

    @Override
    public boolean deleteByMemorabiliaId(int id) {
        return this.geConParkMemorabiliaFeedbackDao.deleteByMemorabiliaId(id) > 0;
    }
}
